package day32.stream;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

// 员工
public class Emp {
	private String name;
	private Integer age;
	private Double salary;
	private State state;

	public Emp() {
	}

	public Emp(String name) {
		this.name = name;
	}

	public Emp(String name, Integer age) {
		this.name = name;
		this.age = age;
	}

	public Emp(String name, Integer age, Double salary) {
		this.name = name;
		this.age = age;
		this.salary = salary;
	}

	public Emp(String name, Integer age, Double salary, State state) {
		this.name = name;
		this.age = age;
		this.salary = salary;
		this.state = state;
	}

	public String getName() {
		return name;
	}

	public Integer getAge() {
		return age;
	}

	public Double getSalary() {
		return salary;
	}

	public State getState() {
		return state;
	}

	@Override
	public String toString() {
		return "Emp [name=" + name + ", age=" + age + ", salary=" + salary + ", state=" + state
				+ "]";
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;
		Emp emp = (Emp) o;
		return Objects.equals(name, emp.name) && Objects.equals(age, emp.age)
				&& Objects.equals(salary, emp.salary);
	}

	@Override
	public int hashCode() {
		return Objects.hash(name, age, salary);
	}

	public static List<Emp> getTestData() {
		return Arrays.asList(
				new Emp("张三", 28, 2300.0, State.FREE),
				new Emp("李富贵", 29, 2450.0, State.BUSY), 
				new Emp("李狗蛋", 37, 2600.0, State.BUSY),
				new Emp("刘大胆", 40, 2300.0, State.VOCATION), 
				new Emp("李二狗", 30, 2350.0, State.BUSY),
				new Emp("king", 28, 5000.0, State.BUSY), 
				new Emp("jones", 20, 2975.0, State.FREE),
				new Emp("blake", 24, 2850.0, State.VOCATION),
				new Emp("clark", 27, 2450.0, State.FREE), 
				new Emp("scott", 22, 3000.0, State.BUSY),
				new Emp("ford", 26, 3000.0, State.BUSY), 
				new Emp("allen", 30, 1600.0, State.FREE),
				new Emp("ward", 32, 1250.0, State.VOCATION),
				new Emp("martin", 29, 1250.0, State.FREE),
				new Emp("turner", 26, 1500.0, State.FREE),
				new Emp("james", 28, 950.0, State.VOCATION),
				new Emp("miller", 33, 1300.0, State.FREE), 
				new Emp("adams", 35, 1100.0, State.BUSY),
				new Emp("smith", 21, 800.0, State.BUSY), 
				new Emp("smith", 21, 800.0, State.BUSY),
				new Emp("smith", 21, 800.0, State.BUSY));
	}

	public enum State {
		FREE, // 空闲
		BUSY, // 忙碌
		VOCATION; // 休假
	}

}
